package com.ruoyi.system.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.OrderMainMapper;
import com.ruoyi.system.domain.OrderMain;
import com.ruoyi.system.service.IOrderMainService;

/**
 * 订单主Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-11-11
 */
@Service
public class OrderMainServiceImpl implements IOrderMainService 
{
    @Autowired
    private OrderMainMapper orderMainMapper;

    /**
     * 查询订单主
     * 
     * @param id 订单主主键
     * @return 订单主
     */
    @Override
    public OrderMain selectOrderMainById(Long id)
    {
        return orderMainMapper.selectOrderMainById(id);
    }

    /**
     * 查询订单主列表
     * 
     * @param orderMain 订单主
     * @return 订单主
     */
    @Override
    public List<OrderMain> selectOrderMainList(OrderMain orderMain)
    {
        return orderMainMapper.selectOrderMainList(orderMain);
    }

    /**
     * 新增订单主
     * 
     * @param orderMain 订单主
     * @return 结果
     */
    @Override
    public int insertOrderMain(OrderMain orderMain)
    {
        orderMain.setCreateTime(DateUtils.getNowDate());
        return orderMainMapper.insertOrderMain(orderMain);
    }

    /**
     * 修改订单主
     * 
     * @param orderMain 订单主
     * @return 结果
     */
    @Override
    public int updateOrderMain(OrderMain orderMain)
    {
        orderMain.setUpdateTime(DateUtils.getNowDate());
        return orderMainMapper.updateOrderMain(orderMain);
    }

    /**
     * 批量删除订单主
     * 
     * @param ids 需要删除的订单主主键
     * @return 结果
     */
    @Override
    public int deleteOrderMainByIds(Long[] ids)
    {
        return orderMainMapper.deleteOrderMainByIds(ids);
    }

    /**
     * 删除订单主信息
     * 
     * @param id 订单主主键
     * @return 结果
     */
    @Override
    public int deleteOrderMainById(Long id)
    {
        return orderMainMapper.deleteOrderMainById(id);
    }
}
